3.2 \(\int \tan (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=69 \[ \frac{a (B+i A) \tan (c+d x)}{d}-\frac{a (A-i B) \log (\cos (c+d x))}{d}-a x (B+i A)+\frac{i a B \tan ^2(c+d x)}{2 d} \]

[Out]

-(a*(I*A + B)*x) - (a*(A - I*B)*Log[Cos[c + d*x]])/d + (a*(I*A + B)*Tan[c + d*x])/d + ((I/2)*a*B*Tan[c + d*x]^
2)/d

________________________________________________________________________________________

Rubi [A]  time = 0.0555895, antiderivative size = 69, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 30, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.1, Rules used = {3592, 3525, 3475} \[ \frac{a (B+i A) \tan (c+d x)}{d}-\frac{a (A-i B) \log (\cos (c+d x))}{d}-a x (B+i A)+\frac{i a B \tan ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

-(a*(I*A + B)*x) - (a*(A - I*B)*Log[Cos[c + d*x]])/d + (a*(I*A + B)*Tan[c + d*x])/d + ((I/2)*a*B*Tan[c + d*x]^
2)/d

Rule 3592

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(B*d*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \tan (c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx &=\frac{i a B \tan ^2(c+d x)}{2 d}+\int \tan (c+d x) (a (A-i B)+a (i A+B) \tan (c+d x)) \, dx\\ &=-a (i A+B) x+\frac{a (i A+B) \tan (c+d x)}{d}+\frac{i a B \tan ^2(c+d x)}{2 d}+(a (A-i B)) \int \tan (c+d x) \, dx\\ &=-a (i A+B) x-\frac{a (A-i B) \log (\cos (c+d x))}{d}+\frac{a (i A+B) \tan (c+d x)}{d}+\frac{i a B \tan ^2(c+d x)}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.306199, size = 70, normalized size = 1.01 \[ \frac{a \left ((-2 B-2 i A) \tan ^{-1}(\tan (c+d x))+2 (B+i A) \tan (c+d x)-2 (A-i B) \log (\cos (c+d x))+i B \tan ^2(c+d x)\right )}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

(a*(((-2*I)*A - 2*B)*ArcTan[Tan[c + d*x]] - 2*(A - I*B)*Log[Cos[c + d*x]] + 2*(I*A + B)*Tan[c + d*x] + I*B*Tan
[c + d*x]^2))/(2*d)

________________________________________________________________________________________

Maple [A]  time = 0.005, size = 110, normalized size = 1.6 \begin{align*}{\frac{{\frac{i}{2}}aB \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{d}}+{\frac{iaA\tan \left ( dx+c \right ) }{d}}+{\frac{aB\tan \left ( dx+c \right ) }{d}}+{\frac{a\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) A}{2\,d}}-{\frac{{\frac{i}{2}}a\ln \left ( 1+ \left ( \tan \left ( dx+c \right ) \right ) ^{2} \right ) B}{d}}-{\frac{iaA\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}}-{\frac{aB\arctan \left ( \tan \left ( dx+c \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

1/2*I*a*B*tan(d*x+c)^2/d+I/d*a*A*tan(d*x+c)+1/d*a*B*tan(d*x+c)+1/2/d*a*ln(1+tan(d*x+c)^2)*A-1/2*I/d*a*ln(1+tan
(d*x+c)^2)*B-I/d*a*A*arctan(tan(d*x+c))-1/d*a*B*arctan(tan(d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.64783, size = 92, normalized size = 1.33 \begin{align*} -\frac{-i \, B a \tan \left (d x + c\right )^{2} - 2 \,{\left (d x + c\right )}{\left (-i \, A - B\right )} a -{\left (A - i \, B\right )} a \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \,{\left (-i \, A - B\right )} a \tan \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(-I*B*a*tan(d*x + c)^2 - 2*(d*x + c)*(-I*A - B)*a - (A - I*B)*a*log(tan(d*x + c)^2 + 1) + 2*(-I*A - B)*a*
tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.46938, size = 304, normalized size = 4.41 \begin{align*} -\frac{2 \,{\left (A - 2 i \, B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} + 2 \,{\left (A - i \, B\right )} a +{\left ({\left (A - i \, B\right )} a e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \,{\left (A - i \, B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} +{\left (A - i \, B\right )} a\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-(2*(A - 2*I*B)*a*e^(2*I*d*x + 2*I*c) + 2*(A - I*B)*a + ((A - I*B)*a*e^(4*I*d*x + 4*I*c) + 2*(A - I*B)*a*e^(2*
I*d*x + 2*I*c) + (A - I*B)*a)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) +
 d)

________________________________________________________________________________________

Sympy [A]  time = 4.95594, size = 110, normalized size = 1.59 \begin{align*} \frac{a \left (- A + i B\right ) \log{\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac{- \frac{\left (2 A a - 4 i B a\right ) e^{- 2 i c} e^{2 i d x}}{d} - \frac{\left (2 A a - 2 i B a\right ) e^{- 4 i c}}{d}}{e^{4 i d x} + 2 e^{- 2 i c} e^{2 i d x} + e^{- 4 i c}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

a*(-A + I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/d + (-(2*A*a - 4*I*B*a)*exp(-2*I*c)*exp(2*I*d*x)/d - (2*A*a - 2*I
*B*a)*exp(-4*I*c)/d)/(exp(4*I*d*x) + 2*exp(-2*I*c)*exp(2*I*d*x) + exp(-4*I*c))

________________________________________________________________________________________

Giac [B]  time = 1.2918, size = 262, normalized size = 3.8 \begin{align*} -\frac{A a e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, B a e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, A a e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, B a e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, A a e^{\left (2 i \, d x + 2 i \, c\right )} - 4 i \, B a e^{\left (2 i \, d x + 2 i \, c\right )} + A a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, B a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 2 \, A a - 2 i \, B a}{d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-(A*a*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - I*B*a*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1
) + 2*A*a*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 2*I*B*a*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*
c) + 1) + 2*A*a*e^(2*I*d*x + 2*I*c) - 4*I*B*a*e^(2*I*d*x + 2*I*c) + A*a*log(e^(2*I*d*x + 2*I*c) + 1) - I*B*a*l
og(e^(2*I*d*x + 2*I*c) + 1) + 2*A*a - 2*I*B*a)/(d*e^(4*I*d*x + 4*I*c) + 2*d*e^(2*I*d*x + 2*I*c) + d)